package com.cloud.dao.impl;

import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Component;

import com.cloud.core.BaseDao;
import com.cloud.dao.PictureBean;

/**
 * 1Cloud1
 * @author Administrator
 * @since 2015-12-4
 * @version 1.0 
 */
@Component("PictureDao")
public class PictureDao extends BaseDao {
	
	/**
	 * 查询图片
	 * @param bean
	 * @return
	 */
	public List<PictureBean> getPictureList(PictureBean bean){
		SqlSession session = super.getInstance(true);
		List<PictureBean> beanList = null;
		try {
			beanList = session.selectList("picture.list", bean);
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		} finally {
			session.close();
		}
		return beanList;
	}
	
	/**
	 * 新增图片
	 * @param bean
	 */
	public void addPicture(PictureBean bean){
		SqlSession session = super.getInstance(true);
		session.insert("picture.insert", bean);
		session.close();
	}
	
	/**
	 * 修改图片
	 * @param bean
	 */
	public void updatePicture(PictureBean bean){
		SqlSession session = super.getInstance(true);
		session.update("picture.update", bean);
		session.close();
	}
	
	/**
	 * 删除图片
	 * @param bean
	 */
	public void deletePicture(PictureBean bean){
		SqlSession session = super.getInstance(true);
		session.delete("picture.delete", bean);
		session.close();
	}
}
